<template>
  <view class="page">
    <view class="head">
      <view class="head-title">{{
        salesReturnDetail.length <= 0
          ? "等待平台处理"
          : salesReturnDetail[0].particulars
      }}</view>
      <!-- <view class="head-title1">{{
        salesReturnDetail.length <= 0
          ? "等待平台处理"
          : salesReturnDetail[0].particulars
      }}</view> -->
      <view class="price">
        <view class="price-flex">
          <view class="price-text">退款金额</view>
          <view class="price-num">￥{{ payMoney }}</view>
        </view>
        <view class="price-text1">申请通过后退回至原账户</view>
      </view>
      <!-- <view class="retutn-btn" v-if="orderStatus == 7" @click="revocation">撤销退款申请</view> -->
    </view>
    <view class="process" v-if="salesReturnDetail.length > 0">
      <view class="process-head">
        <view>退款流程</view>
        <view class="process-flex">
          <image class="customer" src="/static/images/customer.png"></image>
          <view>联系客服</view>
        </view>
      </view>
      <u-steps
        dot
        :current="0"
        direction="column"
        activeColor="#FF4254"
        inactiveColor="#B7BDC6"
      >
        <u-steps-item
          v-for="(item, index) in salesReturnDetail"
          :title="item.particulars"
          :desc="item.createTime"
          :key="index"
        ></u-steps-item>
      </u-steps>
    </view>
    <Empty v-else />
  </view>
</template>

<script>
import Steps from "@/components/steps/index.vue";
import orderApi from "@/api/order";

export default {
  name: "returnDetails",
  components: {
    Steps,
  },
  data() {
    return {
      id: null,
      payMoney: "0.00",
      orderStatus: null,
      active: 0,
      salesReturnDetail: [],
    };
  },
  onLoad(options) {
    this.id = options.id;
    this.payMoney = options.payMoney;
    this.orderStatus = options.orderStatus;
    this.getSalesReturnDetail();
  },
  onShow() {},
  methods: {
    getSalesReturnDetail() {
      let data = {
        soId: this.id,
      };
      orderApi.getSalesReturnDetail(data).then((res) => {
        if (res.code == 200) {
          this.salesReturnDetail = res.rows;
        }
      });
    },
    revocation() {
      uni.showModal({
        title: "提示",
        content: `确认撤销退款吗？`,
        cancelText: "取消",
        confirmText: "确定",
        success: (modalRes) => {
          if (modalRes.confirm) {
            let data = {
              orderId: this.id,
            };
            orderApi.cancelRefund(data).then((res) => {
              if (res.code == 200) {
                uni.showToast({
                  title: "撤销成功",
                  icon: "none",
                });
                setTimeout(() => {
                  uni.navigateBack();
                }, 1500);
              }
            });
          }
        },
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.head {
  width: 694rpx;
  border-radius: 24rpx;
  background: #fff;
  margin: 18rpx 28rpx 20rpx 28rpx;
  padding: 40rpx 20rpx;

  .head-title {
    color: #000000;
    font-family: "PingFang SC";
    font-size: 44rpx;
    font-style: normal;
    font-weight: 500;
  }

  /* .head-title1 {
    color: #000000;
    font-family: "PingFang SC";
    font-size: 28rpx;
    font-style: normal;
    font-weight: 400;
    line-height: 40rpx;
    opacity: 0.5;
    margin-top: 10rpx;
  } */

  .price {
    width: 654rpx;
    height: 120rpx;
    flex-shrink: 0;
    border-radius: 12rpx;
    background: #f8f8f8;
    padding: 20rpx;
    margin-top: 20rpx;
    margin-bottom: 40rpx;
  }

  .price-flex {
    display: flex;
    justify-content: space-between;
  }

  .price-text {
    color: #000000;
    font-family: "PingFang SC";
    font-size: 28rpx;
    font-style: normal;
    font-weight: 400;
    line-height: 40rpx;
    opacity: 0.7;
  }

  .price-text1 {
    color: #000000;
    font-family: "PingFang SC";
    font-size: 24rpx;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    opacity: 0.5;
  }

  .price-num {
    color: #000000;
    text-align: right;
    font-family: "PingFang SC";
    font-size: 28rpx;
    font-style: normal;
    font-weight: 500;
    line-height: 40rpx;
    opacity: 0.7;
    margin-top: 6rpx;
  }
}

.retutn-btn {
  height: 80rpx;
  flex-shrink: 0;
  border-radius: 50rpx;
  border: 2rpx solid #ff4254;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #ff4254;
  font-family: "PingFang SC";
  font-size: 24rpx;
  font-style: normal;
  font-weight: 400;
  line-height: normal;
}

.process {
  width: 694rpx;
  flex-shrink: 0;
  border-radius: 24rpx;
  background: #fff;
  margin: 20rpx 28rpx 20rpx 28rpx;
  padding: 32rpx 20rpx;

  .process-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 24rpx;
  }

  .customer {
    width: 30rpx;
    height: 30rpx;
    margin-right: 6rpx;
  }

  .process-flex {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 180rpx;
    height: 60rpx;
    flex-shrink: 0;
    border-radius: 32rpx;
    border: 2rpx solid #000;
    opacity: 0.5;
  }
}

::v-deep .u-steps-item--column {
  padding-bottom: 40rpx !important;
}
</style>
